package cn.scut.srp.controller.common;

import cn.scut.srp.model.BaseResponse;
import cn.scut.srp.model.ResponseCode;
import cn.scut.srp.service.PublicService;
import cn.scut.srp.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.util.List;

@RestController
@Slf4j
@RequestMapping("/common")
public class PublicController {

    @Autowired
    private PublicService service;

    @GetMapping("/week")
    public BaseResponse<ResponseCode> getReserve(@RequestHeader("Authorization") String token,
                                                 @RequestParam Integer week){
        List<LocalDate> weekToSeek = service.getWeek(week);

        return service.getReserveByWeek(weekToSeek);
    }
}
